class Solution:
    def bestHand(self, ranks: list, suits: list) -> str:
        def isFlush(suits: list):
            pre = suits[0]
            for i in range(1, len(suits)):
                if pre != suits[i]:
                    return False
                pre = suits[i]

            return True

        if isFlush(suits):
            return 'Flush'

        m = {}
        for rank in ranks:
            if rank not in m:
                m[rank] = 0
            m[rank] += 1

        maxNum = 0
        for val in m.values():
            maxNum = max(val, maxNum)

        if maxNum >= 3:
            return 'Three of a Kind'
        elif maxNum >= 2:
            return 'Pair'
        return 'High Card'


if __name__ == '__main__':
    print(Solution().bestHand([4, 4, 2, 4, 4],
                              ["d", "a", "a", "b", "c"]))
